<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>G</title>
<link rel="stylesheet" href="doc.css" type="text/css">
</head>
<body>

<h1>G</h1>

<dl>

<dt><a name="gc"><code>(gc ['cnt]) -> cnt | NIL</code></a>
<dd>Forces a garbage collection. When <code>cnt</code> is given, so many
megabytes of free cells are reserved, increasing the heap size if necessary. If
<code>cnt</code> is zero, all currently unused heap blocks are purged,
decreasing the heap size if possible. See also <code><a
href="refH.html#heap">heap</a></code>.

<pre><code>
: (gc)
-> NIL
: (heap)
-> 2
: (gc 4)
-> 4
: (heap)
-> 5
</code></pre>

<dt><a name="ge0"><code>(ge0 'any) -> num | NIL</code></a>
<dd>Returns <code>num</code> when the argument is a number and greater or equal
zero, otherwise <code>NIL</code>. See also <code><a
href="refL.html#lt0">lt0</a></code>, <code><a
href="refL.html#le0">le0</a></code>, <code><a
href="refG.html#gt0">gt0</a></code>, <code><a href="ref_.html#=0">=0</a></code>
and <code><a href="refN.html#n0">n0</a></code>.

<pre><code>
: (ge0 -2)
-> NIL
: (ge0 3)
-> 3
: (ge0 0)
-> 0
</code></pre>

<dt><a name="genKey"><code>(genKey 'var 'cls ['hook ['num1 ['num2]]]) -> num</code></a>
<dd>Generates a key for a database tree. If a minimal key <code>num1</code>
and/or a maximal key <code>num2</code> is given, the next free number in that
range is returned. Otherwise, the current maximal key plus one is returned. See
also <code><a href="refU.html#useKey">useKey</a></code>, <code><a
href="refG.html#genStrKey">genStrKey</a></code> and <code><a
href="refM.html#maxKey">maxKey</a></code>.

<pre><code>
: (maxKey (tree 'nr '+Item))
-> 8
: (genKey 'nr '+Item)
-> 9
</code></pre>

<dt><a name="genStrKey"><code>(genStrKey 'sym 'var 'cls ['hook]) -> sym</code></a>
<dd>Generates a unique string for a database tree, by prepending as many "# "
sequences as necessary. See also <code><a
href="refG.html#genKey">genKey</a></code>.

<pre><code>
: (genStrKey "ben" 'nm '+User)
-> "# ben"
</code></pre>

<dt><a name="get"><code>(get 'sym1|lst ['sym2|cnt ..]) -> any</code></a>
<dd>Fetches a value <code>any</code> from the properties of a symbol, or from a
list. From the first argument <code>sym1|lst</code>, values are retrieved in
successive steps by either extracting the value (if the next argument is zero)
or a property from a symbol, the <code><a
href="refA.html#asoq">asoq</a></code>ed element (if the next argument is a
symbol), the n'th element (if the next argument is a positive number) or the
n'th CDR (if the next argument is a negative number) from a list. See also
<code><a href="refP.html#put">put</a></code>, <code><a
href="ref_.html#;">;</a></code> and <code><a href="ref_.html#:">:</a></code>.

<pre><code>
: (put 'X 'a 1)
-> 1
: (get 'X 'a)
-> 1
: (put 'Y 'link 'X)
-> X
: (get 'Y 'link)
-> X
: (get 'Y 'link 'a)
-> 1
: (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'a 'b)
-> 1
: (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'd 'f)
-> 4
: (get '(X Y Z) 2)
-> Y
: (get '(X Y Z) 2 'link 'a)
-> 1
</code></pre>

<dt><a name="getd"><code>(getd 'any) -> fun | NIL</code></a>
<dd>Returns <code>fun</code> if <code>any</code> is a symbol that has a function
definition, otherwise <code>NIL</code>. See also <code><a
href="refF.html#fun?">fun?</a></code>.

<pre><code>
: (getd '+)
-> 67327232
: (getd 'script)
-> ((File . @) (load File))
: (getd 1)
-> NIL
</code></pre>

<dt><a name="getl"><code>(getl 'sym1|lst1 ['sym2|cnt ..]) -> lst</code></a>
<dd>Fetches the complete property list <code>lst</code> from a symbol. That
symbol is <code>sym1</code> (if no other arguments are given), or a symbol found
by applying the <code><a href="refG.html#get">get</a></code> algorithm to
<code>sym1|lst1</code> and the following arguments. See also <code><a
href="refP.html#putl">putl</a></code> and <code><a
href="refM.html#maps">maps</a></code>.

<pre><code>
: (put 'X 'a 1)
-> 1
: (put 'X 'b 2)
-> 2
: (put 'X 'flg T)
-> T
: (getl 'X)
-> (flg (2 . b) (1 . a))
</code></pre>

<dt><a name="glue"><code>(glue 'any 'lst) -> sym</code></a>
<dd>Builds a new transient symbol (string) by <code><a
href="refP.html#pack">pack</a></code>ing the <code>any</code> argument between
the individual elements of <code>lst</code>. See also <code><a
href="refT.html#text">text</a></code>.

<pre><code>
: (glue "," '(a b c d))
-> "a,b,c,d"
</code></pre>

<dt><a name="goal"><code>(goal '([pat 'any ..] . lst) ['sym 'any ..]) -> lst</code></a>
<dd>Constructs a <a href="ref.html#pilog">Pilog</a> query list from the list of
clauses <code>lst</code>. The head of the argument list may consist of a
sequence of pattern symbols (Pilog variables) and expressions, which are used
together with the optional <code>sym</code> and <code>any</code> arguments to
form an initial environment. See also <code><a
href="refP.html#prove">prove</a></code> and <code><a
href="refF.html#fail">fail</a></code>.

<pre><code>
: (goal '((likes John @X)))
-> (((1 (0) NIL ((likes John @X)) NIL T)))
: (goal '(@X 'John (likes @X @Y)))
-> (((1 (0) NIL ((likes @X @Y)) NIL ((0 . @X) 1 . John) T)))
</code></pre>

<dt><a name="group"><code>(group 'lst) -> lst</code></a>
<dd>Builds a list of lists, by grouping all elements of <code>lst</code> with
the same CAR into a common sublist. See also <a
href="ref.html#cmp">Comparing</a>, <code><a
href="refB.html#by">by</a></code>, <code><a
href="refS.html#sort">sort</a></code> and <code><a
href="refU.html#uniq">uniq</a></code>.

<pre><code>
: (group '((1 . a) (1 . b) (1 . c) (2 . d) (2 . e) (2 . f)))
-> ((1 a b c) (2 d e f))
: (by name group '("x" "x" "y" "z" "x" "z")))
-> (("x" "x" "x") ("y") ("z" "z"))
: (by length group '(123 (1 2) "abcd" "xyz" (1 2 3 4) "XY"))
-> ((123 "xyz") ((1 2) "XY") ("abcd" (1 2 3 4))
</code></pre>

<dt><a name="gt0"><code>(gt0 'any) -> num | NIL</code></a>
<dd>Returns <code>num</code> when the argument is a number and greater than
zero, otherwise <code>NIL</code>. See also <code><a
href="refL.html#lt0">lt0</a></code>, <code><a
href="refL.html#le0">le0</a></code>, <code><a
href="refG.html#ge0">ge0</a></code>, <code><a href="ref_.html#=0">=0</a></code>
and <code><a href="refN.html#n0">n0</a></code>.

<pre><code>
: (gt0 -2)
-> NIL
: (gt0 3)
-> 3
</code></pre>

</dl>

</body>
</html>
